<%@ include file="/WEB-INF/pages/common/taglibs.jsp" %>
<%@ include file="/WEB-INF/pages/common/checkpermission.jsp" %>
<codelookup:codeCollection id="deptList" codeType="DEPT_LIST"/>
<script type="text/javascript">
    function genereateReport() {
           $("td").removeClass("showErrorClass");
        var currentForm = document.forms["searchReportForm"];
//        var dateFrom = currentForm.elements["searchTO.startDate"];
//        var dateTo = currentForm.elements["searchTO.endDate"];
//        var checkDate = true;
        <%--if (!validateForm_date(dateFrom)) {--%>
            <%--$(dateFrom).parents("tr:first").find("td:first").addClass("showErrorClass");--%>
            <%--checkDate = false;--%>
            <%--addErrorXHTML(dateFrom, $(dateFrom).parents("tr:first").find("td:first").text() + '<s:text name="date.format.error"/>');--%>
        <%--}--%>
        <%--if (!validateForm_date(dateTo)) {--%>
            <%--$(dateTo).parents("tr:first").find("td:first").addClass("showErrorClass");--%>
            <%--checkDate = false;--%>
            <%--addErrorXHTML(dateTo, $(dateTo).parents("tr:first").find("td:first").text() + '<s:text name="date.format.error"/>');--%>
        <%--}--%>
        <%--if (checkDate) {--%>
            <%--if (compare2Dates(dateFrom.value, dateTo.value) > 0) {                            --%>
                <%--alert('<s:text name="label.dateCompare"/>');--%>
                <%--return false;--%>
            <%--}--%>

        <%--}--%>
        var obj1 = currentForm.elements["searchTO.caseoneInd"].checked;
        var obj2 = currentForm.elements["searchTO.casetwoInd"].checked;
        var obj3 = currentForm.elements["searchTO.casethreeInd"].checked;
        var obj4 = currentForm.elements["searchTO.casefourInd"].checked;
        var obj5 = currentForm.elements["searchTO.casefiveInd"].checked;
        var obj6 = currentForm.elements["searchTO.casesixInd"].checked;
        var obj7 = currentForm.elements["searchTO.casesevenInd"].checked;
        var obj8 = currentForm.elements["searchTO.caseeightInd"].checked;
        var obj9 = currentForm.elements["searchTO.casenineInd"].checked;
        var obj10 = currentForm.elements["searchTO.casetenInd"].checked;


        if (!obj1&&!obj2&&!obj3&&!obj4&&!obj5&&!obj6&&!obj7&&!obj8&&!obj9&&!obj10)
        {
              alert('<s:text name="label.reports.select.atleast.one.record"/>');
              return false;
        }
        submitForm("searchReportForm", "generate.action");
        return false;
    }

    function checkAll() {
        document.getElementsByName("searchTO.caseoneInd")[0].checked = true;
        document.getElementsByName("searchTO.casetwoInd")[0].checked = true;
        document.getElementsByName("searchTO.casethreeInd")[0].checked = true;
        document.getElementsByName("searchTO.casefourInd")[0].checked = true;
        document.getElementsByName("searchTO.casefiveInd")[0].checked = true;
        document.getElementsByName("searchTO.casesixInd")[0].checked = true;
        document.getElementsByName("searchTO.casesevenInd")[0].checked = true;
        document.getElementsByName("searchTO.caseeightInd")[0].checked = true;
        document.getElementsByName("searchTO.casenineInd")[0].checked = true;
        document.getElementsByName("searchTO.casetenInd")[0].checked = true;
    }
    function back() {
        submitForm("searchReportForm", "../cases/clientSummary.action");
    }
</script>
<div id='searchReportFormDiv'>
    <s:form name="searchReportForm" action="">
        <table align="center" cellpadding="0" cellspacing="0" class="body_content full_width">
            <tr>
                <td align="left" valign="bottom" class="main_page_content_icon" width="4%">
                    <img src='<c:url value="/images/body-icon_check.gif"/>' width="29" height="44">
                </td>
                <td valign="bottom" class="page_title_bg" width="96%"><span class="page_title"><s:text
                        name="label.report"/></span></td>
            </tr>
            <tr>
                <td class="subcontent">&nbsp;</td>
                <td class="subcontent">
                    <table class="sectionBorder" width="100%">
                        <tr>
                            <td class="form_label_padded" width="10%" nowrap><s:text
                                    name='label.dateFrom'/></td>
                            <td class="form_label_padded" width="2%">:</td>
                            <td class="txtData" align="left">
                                <monitor:date name="searchTO.startDate"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="10%" nowrap><s:text name='label.dateTo'/></td>
                            <td class="form_label_padded" width="2%">:</td>
                            <td class="txtData" align="left">
                                <monitor:date name="searchTO.endDate"/>
                            </td>
                        </tr>
                        <%--<tr>--%>
                            <%--<td class="form_label_padded" width="10%" nowrap><s:text name='label.caseone.deptId'/></td>--%>
                            <%--<td class="form_label_padded" width="2%">:</td>--%>
                            <%--<td class="txtData" align="left">--%>
                                <%--<s:select list="#attr.deptList" name="searchTO.deptId" listKey="codeId" headerKey=" " headerValue=" "--%>
                                          <%--listValue="codeDesc"/>--%>
                            <%--</td>--%>
                        <%--</tr>--%>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.caseoneInd"/><s:text name='label.case.select.title1'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casetwoInd"/><s:text name='label.case.select.title2'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casethreeInd"/><s:text name='label.case.select.title3'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casefourInd"/><s:text name='label.case.select.title4'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casefiveInd"/><s:text name='label.case.select.title5'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casesixInd"/><s:text name='label.case.select.title6'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casesevenInd"/><s:text name='label.case.select.title7'/>
                            </td>
                        </tr>
                        <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.caseeightInd"/><s:text name='label.case.select.title8'/>
                            </td>
                        </tr>
                         <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casenineInd"/><s:text name='label.case.select.title9'/>
                            </td>
                        </tr>
                         <tr>
                            <td class="form_label_padded" width="100%" nowrap colspan="3">
                                <s:checkbox name="searchTO.casetenInd"/><s:text name='label.case.select.title10'/>
                            </td>
                        </tr>
                        <script type="text/javascript">
                            checkAll();
                        </script>
                        <tr>
                            <td class="txtData" colspan="6">
                                <input type="button" class="button" value="<s:text name='label.reports.generate'/>"
                                       onclick="genereateReport()">
                                <input type="button" class="button" value="<s:text name='label.back'/>" onclick="back();">
                            </td>
                        </tr>

                    </table>
                </td>
            </tr>
        </table>
    </s:form></div>
